<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>预约留言管理系统</title>
    <link rel="stylesheet" href="/Public/layui/css/layui.css">
    <link rel="stylesheet" href="/Public/assets/css/admin.css">
    <script src="http://apps.bdimg.com/libs/jquery/1.9.0/jquery.min.js"></script>
    <script type="text/javascript" src="/Public/assets/js/echarts.min.js"></script>
</head>

<body class="layui-layout-body">
    <div class="layui-layout layui-layout-admin">
        <include file="Index/header" />
        <include file="Index/nav" />
        <div class="layui-body">
            <div style="padding: 15px;">
                <div id="chart" style="width: 100%; height: 500px;"></div>
            </div>
        </div>
    </div>
    <script src="/Public/layui/layui.js"></script>
    <script>
    $(document).ready(function() {
        var chart = document.getElementById('chart');
        var chartData = echarts.init(chart);
        chartData.setOption({
            title: {
                text: '近30天留言状况'
            },
            tooltip: {
                trigger: 'axis'
            },
            grid: {
                left: '3%',
                right: '4%',
                bottom: '3%',
                containLabel: true

            },
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            xAxis: {
                type: 'category',
                boundaryGap: false,
                data: []
            },
            yAxis: {
                type: 'value'
            },
        });

        $.get('/liuyan.php?c=liuyan&a=lately').done(function(data) {
            console.dir(data);
            // 填入数据
            chartData.setOption({
                xAxis: {
                    data: data.times
                },
                legend: {
                    data: data.hospital
                },
                series: data.hospitals
            });
        });
        function eConsole(param) {
            console.dir(param);
        }
        chartData.on("click", eConsole);
    });
    </script>
</body>

</html>